/* * Copyright the original author or authors. *  * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *  *      http://www.mozilla.org/MPL/MPL-1.1.html *  * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.bourre.ioc.load.runtime {
	import com.bourre.ioc.assembler.displayobject.DefaultDisplayObjectBuilder;	import com.bourre.ioc.load.ApplicationLoader;		import flash.display.DisplayObjectContainer;	import flash.net.URLRequest;			/**
	 * Context builder to use with <code>RuntimeContextLoader</code> context 	 * loader.	 * 	 * @see RuntimeContextLoader	 * 	 * @author Romain Ecarnot
	 */
	public class RTDisplayObjectBuilder extends DefaultDisplayObjectBuilder 	{
		//--------------------------------------------------------------------		// Protected properties		//--------------------------------------------------------------------				/** @private */		protected var _basePrefix : String;								//--------------------------------------------------------------------		// Public API		//--------------------------------------------------------------------				/**		 * Creates new <code>RTDisplayObjectBuilder</code> instance.		 */			public function RTDisplayObjectBuilder( rootTarget : DisplayObjectContainer = null)		{
			super( rootTarget );
		}				/** @private */		public function setDomainRootPath( basePath : String ) : void		{			_basePrefix = basePath;		}				/**		 * @inheritDoc		 * 		 * Chekcs if using context sandbox to retreive correct url.		 * 		 * @see RuntimeContextLoader#sandbox		 * 		 * @return	The correct URLRequest of targeted element.		 */		override public function getURLRequest( request : URLRequest, prefix : String = null ) : URLRequest		{			if( request.url.indexOf( ApplicationLoader.ABSOLUTE_PATH ) < 0 )			{				if( _basePrefix != null )				{					return new URLRequest( _basePrefix + request.url );				}			}						return super.getURLRequest(request, prefix);		}	}
}
